ActionController::Routing::Routes.draw do |map|

  map.activate '/:nick_name/activate/:activation_code', :action => 'activate', :controller => 'user'
  map.logout '/logout', :action => 'destroy', :controller => 'sessions'
  map.login '/login', :action => 'new', :controller => 'sessions'
  map.register '/register', :action => 'create', :controller => 'user'
  map.signup '/signup', :action => 'new', :controller => 'user'
  
  map.resources :user do |user|
    user.resources :collects
  end

  map.u '/u/:id', :controller => 'user', :action => 'show'
  map.u_reviews '/u/:id/reviews', :controller => 'user', :action => 'reviews'
  map.account '/myaccount', :controller => 'myaccount', :action => 'edit'
  map.resources :myaccount, :collection => {:auth => :get, :resetpassword => :get, :resetemail => :get, :user_icon => :get, :update_user_name => :post, :submit_resetpassword => :post, :update_email => :post, :update_pic => :post, :upload_pic => :post}

  map.resource :session

  map.resources :category#, :member => { :cat2 => :get }
  map.resources :ratings
  map.resources :styles, :brands, :recommend_subjects, :recommend_items
  
  map.cat2 '/category/:parent_id/:id', :controller => 'category', :action => 'cat2'
  map.search '/search/:keyword', :controller => 'search', :action => 'index', :keyword => nil
  map.tag '/tag/:name', :controller => 'tag', :action => 'show', :requirements => { :name => /.+?/ }
  map.tag_with_page '/tag/page/:page', :controller => 'tag', :action => 'index'
  
  map.resources :items do |items|
    items.resources :collections, :collection => { :new_interest=>:get,:create_interest => :post,:new_rating=>:get }
    items.resources :photos
    items.resources :reviews
#    item.resouces :collections, :collection => { :user_collection=>:get }
  end

  map.resources :item_review_votes

  #map.resources :tag
  
  map.root :controller => 'home'

#    map.resources :item
#  map.register_comment '/register_comment/:id',:controller=>'item',:action=>'register_comment'
#  map.dialog '/dialog/:id',:controller=>'item',:action=>'dialog'
#  map.recommend '/recommend/:id',:controller=>'item',:action=>'recommend'
#  map.collect '/collect/:id',:controller=>'item',:action=>'collect'
#  map.interest '/interest/:id',:controller=>'item',:action=>'interest'
#  map.vote '/vote/:review_id/:vote',:controller=>'item',:action=>'up_down'
#  map.reply '/reply/:review_id',:controller=>'item',:action=>'replay'
#  map.reviews '/item/:id/reviews',:controller=>'item',:action=>'reviews'
  
  map.connect "logged_exceptions/:action/:id", :controller => "logged_exceptions"
  
  # The priority is based upon order of creation: first created -> highest priority.

  # Sample of regular route:
  #   map.connect 'products/:id', :controller => 'catalog', :action => 'view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   map.resources :products

  # Sample resource route with options:
  #   map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }

  # Sample resource route with sub-resources:
  #   map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
  
  # Sample resource route with more complex sub-resources
  #   map.resources :products do |products|
  #     products.resources :comments
  #     products.resources :sales, :collection => { :recent => :get }
  #   end

  # Sample resource route within a namespace:
  #   map.namespace :admin do |admin|
  #     # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
  #     admin.resources :products
  #   end

  # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
  # map.root :controller => "welcome"

  # See how all your routes lay out with "rake routes"

  # Install the default routes as the lowest priority.
  # Note: These default routes make all actions in every controller accessible via GET requests. You should
  # consider removing or commenting them out if you're using named routes and resources.
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end
